import { ModuleStoreKeys, SystemInfo } from '@/store/constant'
import { defineStore } from 'pinia'
import { reactive } from 'vue'

/**
 * @ClassName systemStore
 * @Description 系统设置相关的存储类
 * @Author xuyizhuo
 * @Date 2024/12/22 16:01
 * @example
 */
export default defineStore(ModuleStoreKeys.SYSTEM, () => {
    console.log('systemStore')
    const theme = reactive({
        themeName: SystemInfo.THEME.defaultThemeName,
    })

    /** 更新主题名称 */
    const updateThemeName = (theme: string) => {
        document.documentElement.setAttribute('theme', theme)
    }

    // console.log('window.document.body', window.document.body)
    updateThemeName(theme.themeName)
    return {
        theme,
        updateThemeName,
    }
})
